package com.xtayfjpk.spring.security.test.service;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;

import com.xtayfjpk.spring.security.test.domain.Customer;

@Service
public class CustomerService {
	
	@PreAuthorize("hasPermission(#id, 'com.xtayfjpk.spring.security.test.domain.Customer', read) or "
			+ "hasPermission(#id, 'com.xtayfjpk.spring.security.test.domain.Customer', admin)")
	public Customer getById(Long id) {
		Customer customer = new Customer();
		customer.setAddress("广东");
		customer.setAge(25);
		customer.setGroup("消费者");
		customer.setId(id);
		customer.setName("张三");
		return customer;
	}
}
